package com.example.controller;


import com.example.common.Result;
import com.example.entity.Goods;
import com.example.entity.RescueRecord;
import com.example.entity.Room;
import com.example.service.RescueRecordService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 动物救助前端操作接口
 **/
@RestController
@RequestMapping("/save")
public class SaveController {

    @Resource
    private RescueRecordService rescueRecordService;

    /**
     * 查询所有信息
     */
    @GetMapping("/findAll")
    public Result selectAll(RescueRecord rescueRecord,
                            @RequestParam(defaultValue = "1") Integer pageNum,
                            @RequestParam(defaultValue = "10") Integer pageSize) {
        PageInfo<RescueRecord> page = rescueRecordService.selectPage(rescueRecord, pageNum, pageSize);
        return Result.success(page);
    }
    @PostMapping("/update")
    public Result updateById(@RequestBody RescueRecord rescueRecord) {
        boolean b = rescueRecordService.updateById(rescueRecord);
        return Result.success(200);
    }
    @PostMapping("/add")
    public Result addById(@RequestBody RescueRecord rescueRecord) {
        boolean b = rescueRecordService.save(rescueRecord);
        return Result.success(200);
    }
}
